//package com.mes.system.service;
//
//import java.util.List;
//
//import javax.servlet.http.HttpServletRequest;
//
//import org.apache.commons.logging.Log;
//import org.apache.commons.logging.LogFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.context.ApplicationContext;
//import org.springframework.context.ApplicationContextAware;
//
//import com.mes.common.exception.bo.BaseBusinessException;
//import com.mes.common.spring.SpringUtils;
//import com.mes.device.dao.MaintainTaskDao;
///*import com.mes.device.Dao.iface.MaintainTaskDao;
//import com.mes.device.persistence.domain.MaintainTask;
//import com.mes.prepare.Dao.iface.PrepareTaskDao;
//import com.mes.system.manager.iface.MessageManager;
//import com.mes.system.persistence.domain.Message;*/
//import com.mes.system.domain.MesMessage;
//
//public class MessageService implements ApplicationContextAware {
//	private final static Log log = LogFactory.getLog("MessageService.class");
//	private ApplicationContext ctx;
//	@Autowired
//	private MaintainTaskDao maintainTaskDao;
///*	private PrepareTaskDao prepareTaskDao;
//*/
//	public void setApplicationContext(ApplicationContext ctx) {
//		this.ctx = ctx;
//	}
//
//	public void perform(MesMessage message) {
//
//		MessageEvent evt = new MessageEvent(message);
//		ctx.publishEvent(evt);
//	}
//
//	public String getHttpSessionId() {
//		try {
//			HttpServletRequest request = WebContextFactory.get()
//					.getHttpServletRequest();
//			log.info("*******************session��ţ�"
//					+ request.getSession().getId());
//			return request.getSession().getId();
//		} catch (RuntimeException e) {
//			e.printStackTrace();
//		}
//		return "";
//	}
//
//	public String getFunctionMessage(String deptUid, String functionType) {
//		StringBuilder messageString = null;
//
//		try {
//
////			if (functionType.equals("maintain")) {
////				List<MaintainTask> maintTaskList = maintainTaskDao
////						.getUnFinishMaintainTasks(deptUid, null);
////
////				if (maintTaskList != null && maintTaskList.size() > 0) {
////					for (MaintainTask maintainTask : maintTaskList) {
////
////					}
////
////				}
////			} else if (functionType.equals("summaryCheck")) {
////
////			} else if (functionType.equals("firstCheck")) {
////
////			} else if (functionType.equals("routinePrepare")) {
////
////			} else if (functionType.equals("toolPrepare")) {
////				List
////
////			}
//		} catch (Exception e) {
//			e.printStackTrace();
//		}
//		return messageString.toString();
//	}
//
//	/*
//	 * ����ĳһ�û�ֵ���������ʼ��Ϣ
//	 */
//	public String onPageLoad(String userId) {
//		if (userId == null)
//			return null;
//		ScriptSession scriptSession = WebContextFactory.get()
//				.getScriptSession();
//
//		scriptSession.setAttribute("userId", userId);
//		//scriptSession.ge
//
//		//        DwrScriptSessionManagerUtil dwrScriptSessionManagerUtil = new DwrScriptSessionManagerUtil();  
//		//   
//		//        try {  
//		//   
//		//               dwrScriptSessionManagerUtil.init();  
//		//               System.out.println("cacaca");  
//		//   
//		//        } catch (ServletException e) {  
//		//   
//		//               e.printStackTrace();  
//		//   
//		//        }  
//
////		String messageString = null;
////
////		try {
////			MessageManager messageManager = (MessageManager) SpringUtils
////					.getBean("messageManager");
////			messageString = messageManager
////					.getUnReadMessageTopicsByEmployeeId(userId);
////		} catch (BaseBusinessException e) {
////			e.printStackTrace();
////		}
//
//		return null;
//
//	}
//
//}